package com.charles.springcloud.controller;

import com.charles.common.CommonResult;
import com.charles.springcloud.entity.Payment;
import com.charles.springcloud.service.PaymentFeignService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: 风中灵劲草
 * @Date: 2021/08/05/17:12
 * @Description:
 */
@RestController
@RequestMapping("/payment")
public class PaymentController {
    
    @Autowired
    private PaymentFeignService paymentFeignService;
    
    @GetMapping("/get/{id}")
    public CommonResult<Payment> getPaymentById(@PathVariable("id") Long id) {
        return paymentFeignService.getPaymentById(id);
    }

    @GetMapping(value = "/payment/feign/timeout")
    public String feignTimeout(){
        //openfeign-ribbon,客户端默认等待1s
        return paymentFeignService.feignTimeout();
    }
}
